package com.winit.deploy.task.tomcatTask;

import com.winit.common.util.JSONFileUtil;
import com.winit.core.task.Task;
import org.springframework.util.StringUtils;

/**
 * Created by wangjian on 16/8/16.
 */
public class SleepTask extends Task {

    public SleepTask(String taskId, Integer expireTime) {
        super(taskId, expireTime);
    }

    @Override
    public TaskStatus call() throws Exception {
        System.out.println("SleepTask:start");
        Thread.sleep(10000);
        String str = JSONFileUtil.getFileString("/usr/local/Beetle/testTask.json");
        if(StringUtils.isEmpty(str)){
            return TaskStatus.STATUS_SUCCESS;
        }
        TaskStatus status = Enum.valueOf(TaskStatus.class,str);
        System.out.println("SleepTask:stop");
        return status;
    }
}
